/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package RunableClass;

import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import mysql.connectServer;
import STOCK.STOCK;
/**
 *
 * @author Anatomy
 */
public class GetSymbolServer {
    
String symbol;
JTextField JT;
JLabel JL;
JButton JB;
    public GetSymbolServer(JTextField JT,JLabel JL,JButton btChart) {
        this.symbol=JT.getText();
       this.JT=JT;
       this.JL=JL;
       this.JB=btChart;
    }

   
    public void GetSymbol() {
        JL.setText("waiting");
        try {
            connectServer Cn2Sv=new connectServer("stock_server");
            String sql="SELECT count(*) FROM `server_symbol` Where SymbolName='"+symbol+"'";
            System.out.println(sql);
            ResultSet executeQuery = Cn2Sv.stmt.executeQuery(sql);
            executeQuery.next();
            if(executeQuery.getInt(1)>0){
                JL.setText("");
                    System.out.println("found");
                   // JB.setEnabled(true);
                //JT.setEnabled(true);
            }else{
                //  JB.setEnabled(false);
                 JL.setText("Not Found.");
            }
            
          
            // JT.setEnabled(true);
        } catch (SQLException ex) {
       
                  }
        
    }
    
}
